<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:action name="header" executeResult="true">
	<s:param name="titles">Quản lý đơn đặt hàng</s:param>
</s:action>
<s:action name="managesidebar" executeResult="true" />

<!-- Center -->
<div id="center_column_des" class="center_column">

<!-- MODULE success -->
<!-- Breadcrumb -->
<div class="breadcrumb">
	<a href="<s:url action="index"></s:url>">Trang chủ</a><span class="navigation-pipe">&gt;</span><span class="navigation_page">Quản lý đơn đặt hàng</span>
</div>
<!-- /Breadcrumb -->
	<table class="list">
		<thead>
			<tr>
				<td width="1" style="text-align: center;vertical-align:middle;">ID</td>
				<td class="left">Tên người nhận</td>
				<td class="left">Công ty</td>
				<td class="right">Điện thoại</td>
				<td class="right">Trạng thái</td>
				<td class="right">Chức năng</td>
			</tr>
		</thead>
		<tbody>
		<s:set name="stt" value="0"/>
		<s:if test="%{billList.size > 0}" >		
			<s:iterator value="billList" var="bill">
			<tr>
				<td style="text-align: center;"><s:property value="#bill.bill_id"/></td>
				<td class="left"><s:property value="#bill.full_name"/></td>
				<td class="left"><s:property value="#bill.company"/></td>
				<td class="right"><s:property value="#bill.phone"/></td>
				<td class="right"><s:if test="#bill.accepted==1">Chờ duyệt</s:if><s:elseif test="#bill.accepted==2">Hoàn thành</s:elseif><s:else>Bị hủy</s:else></td>
				<td class="right">
					[<a href="" onclick="actionF(<s:property value="#bill.bill_id" />,'view');return false;" style="color:#003366;">Xem</a>] | 
					[<a href="" onclick="if(confirm('Bạn có muốn xóa đơn đặt hàng này không?')){actionF(<s:property value="#bill.bill_id" />,'del');}return false;" style="color:#003366;">Xóa</a>]
				</td>				
			</tr>	
			</s:iterator>
		</s:if>
		<s:else>
			<tr>
				<td colspan="6" style="text-align:center;">Không có đơn đặt hàng nào !</td>
			</tr>
		</s:else>
		</tbody>
	</table>
	${pagination}
	<form action="" method="post" class="std" enctype="multipart/form-data" id="actionF">
		<input type="hidden" value="" name="sid" id="sid" />
		<input type="hidden" value="" name="saction" id="saction" />
		<input type="hidden" value='<s:url action="managebill"></s:url>' name="link" />
	</form>
<script type="text/javascript">
function actionF(slideId,action){
	var pidVal = $("#sid");
	var pactionVal = $("#saction");
	var editorVal = $("#actionF");
	var delUrl = '<s:url action="managebill"></s:url>';
	var viewUrl = '<s:url action="viewbill"></s:url>';
	pidVal.val(slideId);
	if(action == "del"){
		pactionVal.val("del");
		editorVal.attr("action", delUrl);
	}else{
		pactionVal.val("view");
		editorVal.attr("action", viewUrl);
	}
	
	editorVal.submit();
}

</script>	
</div>

<s:action name="footer" executeResult="true" />